package com.xmy.cultivate.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xmy.cultivate.entity.EduVersion;
import com.xmy.cultivate.service.IEduVersionService;
import com.xmy.cultivate.util.Code;
import com.xmy.cultivate.util.PageResult;
import com.xmy.cultivate.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 课程版本 前端控制器
 * </p>
 *
 * @author hpiggy
 * @since 2025-10-11
 */
@RestController
@RequestMapping("/api/eduVersion")
public class EduVersionController {

    @Autowired
    private IEduVersionService iEduVersionService;

    @GetMapping()
    public Result list(
            @RequestParam(value = "yearClassId", required = false, defaultValue = "") String yearClassId,
            @RequestParam(value = "subjectsId", required = false, defaultValue = "") String subjectsId,
            @RequestParam(value = "classTypeId", required = false, defaultValue = "") String classTypeId
    ) {
        QueryWrapper<EduVersion> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("deleted", 0);
        List<EduVersion> list = iEduVersionService.list(queryWrapper);
        return new Result(Code.GET_OK, new PageResult<>(list, (long) list.size(), 1L));
    }
}
